<template>
  <!-- 全部提醒 -->
  <div class="all bg1" @rightBtn="rightBtn">
    <div class="warning" v-if="isShowWarning" @click="onClickSetting">
      <LImage :src="Config.img('ic_ai_warning.png')" alt="" class="warning-img" />
      <text class="font24 warning-text">{{T('注意:需要通知权限，否则无法接受App推送')}}</text>
      <LImage class="cell-arrow" :src="Config.img('jiantou_lan.png')" />
    </div>
    <VSubMaxMenu class="menu" :menu="menu" :menus="menus" @menuClick="menuClick"></VSubMaxMenu>

    <sub :menu="menu" key="my" ref="my" v-if="menu == 0"></sub>
    <sub :menu="menu" key="his" ref="his" v-else></sub>

  </div>

</template>

<style src="@/_css/style.css" ></style>
<style scoped>
  .menu {
    height: 80px;
    margin-top: 10px;
  }
  .refresh {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    width: 750px;
    height: 80px;
  }
  .warning {
    display: flex;
    flex-direction: row;
    align-items: center;
    background-color: rgba(240, 56, 105, 0.1);
    height: 72px;
  }
  .warning-img {
    width: 28px;
    height: 28px;
    margin-left: 40px;
    margin-right: 10px;
  }
  .warning-text {
    flex: 1;
    color: #db4564;
  }
  .cell-arrow {
    width: 18px;
    height: 18px;
    margin-right: 30px;
  }
</style>

<script>
  //组件
  import VSubMaxMenu from "@/_public/VSubMaxMenu.vue";
  import sub from "./tipAllSub.vue";
  import jconfig from "@/_js/config";
  import jmodal from "@/_js/modal";
  import jdebug from "@/_js/debug";
  import jhttps from "@/_js/https";
  import jnavigator from "@/_js/navigator";
  const clipboard = weex.requireModule("clipboard");

  const animation = weex.requireModule("animation"); //动画
  const domModule = weex.requireModule("dom");
  const stream = weex.requireModule("stream"); //网络请求
  const weexFunction = weex.requireModule("WeexFunction");
  import I18N from "@/_i18n/i18n";
  var T = I18N.t;
  weexFunction.setTitle(T("全部提醒"));
  weexFunction.setRightBtn(T("提醒配置"));
  export default {
    components: {
      VSubMaxMenu,
      sub,
    },

    data() {
      return {
        Config: jconfig,
        T: T,
        isShowWarning: false, //显示警告
        isRefresh: false, //显示刷新
        data: undefined,
        menu: 0,
        menus: [T("我的预警"), T("历史预警")],
      };
    },

    created() {},

    mounted() {
      
      let isIos = weex.config.env.platform.toUpperCase() != "ANDROID";
      if (isIos) {
        this.isShowWarning = true;
      }
    },

    methods: {
      /********************************** 点击*/
      //提醒配置
      rightBtn() {
        jnavigator.open("", "aide/tipConfig");
      },

      //菜单点击
      menuClick(index) {
        this.menu = index;
        if (index == 0) {
          this.$refs.my.refresh();
        } else {
          this.$refs.his.refresh();
        }
      },
      onClickSetting() {

        weexFunction.showWebUrl("app-settings:");
      },
    },
  };
</script>